﻿using System;
using fastCSharp;

namespace OnlineJudgeServer
{
    class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        static void Main(string[] args)
        {
            if (fastCSharp.config.appSetting.IsCheckMemory) checkMemory.Add(typeof(Program));
            fastCSharp.threading.task.Tiny.Add(setEnvironmentPath);
            fastCSharp.diagnostics.consoleLog.Start(new console());
        }
        /// <summary>
        /// 设置环境变量PATH
        /// </summary>
        private static void setEnvironmentPath()
        {
            string path = (Environment.GetEnvironmentVariable("PATH") + ";" + fastCSharp.config.pub.LoadConfigName<string[]>("OnlineJudgeServer.EnvironmentPath").joinString(';')).toLower().split(';')
                .getHash(value => value.Trim()).getFind(value => value.Length != 0).joinString(';');
            Environment.SetEnvironmentVariable("PATH", path, EnvironmentVariableTarget.Machine);
        }
    }
}
